using FluentValidation;
using Jupiter.Infrastructure.Domain;
using MediatR;
using Wips.AppService.Authorities.Organizations.ViewModels;

namespace Wips.AppService.Authorities.Organizations.Requests
{
    /// <summary>
    /// 创建组织架构请求类
    /// </summary>
    public class CreateOrganizationRequest : OrganizationViewModel, IRequest<string>,ITxRequest
    {
        /// <summary>
        /// 角色Ids
        /// </summary>
        public IList<string> RoleIds { get; set; } = new List<string>();
    }

    /// <summary>
    /// 
    /// </summary>
    public class CreateOrganizationValidator : AbstractValidator<CreateOrganizationRequest>
    {
        /// <summary>
        /// 
        /// </summary>
        public CreateOrganizationValidator()
        {
            RuleFor(p => p.Name)
                .Must(p => !string.IsNullOrEmpty(p))
                .WithMessage("名称不能为空")
                .MaximumLength(32)
                .WithMessage("名称最大支持32个字");
            //RuleFor(p => p.ContactName)
            //    .Must(p => !string.IsNullOrEmpty(p))
            //    .WithMessage("联系人不能为空")
            //    .MaximumLength(8)
            //    .WithMessage("联系人姓名最大支持8个字");
            //RuleFor(p => p.ContactPhoneNumber)
            //    .Must(p => !string.IsNullOrEmpty(p))
            //    .WithMessage("手机号不能为空")
            //    .MaximumLength(11)
            //    .WithMessage("手机号长度只能为11位");
        }
    }
}